{% extends 'bugs/base.html' %}
{% load staticfiles %}

{% block title %}登录{% endblock %}
{% block extrastyle %}

{% endblock %}
{% block content %}
    <div class="container">
        <div class="row">
            <div class="col-sm-2" id="add_top"></div>
            <div class="col-sm-8" id="add_cent">
                <div class="panel panel-default" id="add_pan">
                    <div class="panel-body">
                        <p id="add_yh">刪除用戶</p>
                        <div class="col-lg-6" id="input_con">
                            <form action="/delete_form/" method="post">
                                <div class="input-group" style="margin:0 0 0 0;padding:0 0 0 0">
                                    <input type="text" class="form-control" placeholder="請輸入工號..." name="userid">
                                    <span class="input-group-btn">
                                    <button class="btn btn-default" type="submit" style="height:34px;">Go!</button>
                                </span>
                                </div>
                            </form>
                        </div>
                    </div>
                </div>
                <div class="panel panel-default" id="numcon">
                    <div class="panel-body">
                        {% if fail %}
                            <div><img src="{% static 'MainWindow/images/failure.png' %}" class="img-responsive"
                                      alt="对不起未能查找到此员工，请您核对工号后重新查找。。。"></div>
                        {% endif %}
                        {% if message %}
                            <!-- myModal -->
                            <div class="modal fade" id="myModal" tabindex="-1" role="dialog"
                                 aria-labelledby="myModalLabel">
                                <div class="modal-dialog" role="document">
                                    <div class="modal-content">
                                        <div class="modal-header">
                                            <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                                                <span aria-hidden="true">&times;</span></button>
                                            <h4 class="modal-title" id="myModalLabel" style="font-weight:800;">刪除用戶</h4>
                                        </div>
                                        <div class="modal-body">
                                            用戶刪除成功!!!
                                        </div>
                                        <div class="modal-footer">
                                            <button type="button" class="btn btn-default" data-dismiss="modal">確認
                                            </button>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <!--
                            <script type="text/javascript">
                                $(function(){
                                    $('#myModal').modal({
                                    show:true,
                                    backdrop:true
                                    })
                                });
                            </script>
                            -->

                        {% endif %}
                        <form action="/delete_form_confirm/" method="post" class="form-horizontal"
                              style="margin-right:40px;">
                            {% csrf_token %}
                            {% if user_data %}
                                {% for data in user_data %}
                                    <div class="form-group">
                                        <label for="inputPassword3" class="col-sm-2 control-label">工號</label>
                                        <div class="col-sm-10">
                                            <input type="text" class="form-control" id="userid" name="userid" readonly
                                                   value={{ data.user_id }}>
                                        </div>
                                    </div>
                                    <br>
                                    <div class="form-group">
                                        <label for="inputEmail3" class="col-sm-2 control-label">中文名</label>
                                        <div class="col-sm-10">
                                            <input type="text" class="form-control" id="c_name" name="c_name" readonly
                                                   value={{ data.c_name }}>
                                        </div>
                                    </div>
                                    <br>
                                    <div class="form-group">
                                        <label for="inputEmail3" class="col-sm-2 control-label">英文名</label>
                                        <div class="col-sm-10">
                                            <input type="text" class="form-control" id="e_name" name="e_name" readonly
                                                   value={{ data.e_name }}>
                                        </div>
                                    </div>
                                    <br>
                                    <div class="form-group">
                                        <label for="inputEmail3" class="col-sm-2 control-label">密碼</label>
                                        <div class="col-sm-10">
                                            <input type="text" class="form-control" id="password" name="password"
                                                   readonly
                                                   value={{ data.password }}>
                                        </div>
                                    </div>
                                    <br>
                                    <div class="form-group">
                                        <label for="inputPassword3" class="col-sm-2 control-label">權限</label>
                                        <div class="col-sm-10">
                                            <select class="form-control" name="authority">
                                                <option {% ifequal data.authority '1' %}selected{% endifequal %}>admin
                                                </option>
                                                <option {% ifequal data.authority '2' %}selected{% endifequal %}>
                                                    engineer
                                                </option>
                                                <option {% ifequal data.authority '3' %}selected{% endifequal %}>user
                                                </option>
                                            </select>
                                        </div>
                                    </div>
                                    <br>
                                    <div class="form-group">
                                        <label for="inputPassword3" class="col-sm-2 control-label">分机号</label>
                                        <div class="col-sm-10">
                                            <input type="phone" class="form-control" name="phone" id="phone"
                                                   placeholder="phone" value="{{ data.phone }}">
                                        </div>
                                    </div>
                                    <br>
                                    <div class="form-group">
                                        <label for="inputPassword3" class="col-sm-2 control-label">Team</label>
                                        <!--#:此处页面上没有显示数据-->
                                        <div class="col-sm-10">
                                            <input type="text" class="form-control" id="team" name="team"
                                                   value={{ data.team }}>
                                        </div>
                                    </div>
                                {% endfor %}
                                <br>
                                <div class="form-group">
                                    <div class="col-sm-offset-4 col-sm-10">
                                        <button id="btn_01" type="submit" class="btn btn-primary btn-lg"><p
                                                style="margin:0 0 0 0;font-size:17px;font-weight:bold;font-family:'微软雅黑'">
                                            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;確&nbsp;&nbsp;&nbsp;認&nbsp;&nbsp;&nbsp;刪&nbsp;&nbsp;&nbsp;除&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</p>
                                        </button>
                                    </div>
                                </div>
                            {% endif %}
                        </form>
                    </div>
                </div>
            </div>
        </div>
    </div>
{% endblock %}